<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <link th:href="@{/css/Semantic-UI-CSS-master/semantic.css}" href="../../static/css/Semantic-UI-CSS-master/semantic.css" rel="stylesheet" type="text/css">
    <link th:href="@{/lib/editormd/css/editormd.css}" href="../../static/lib/editormd/css/editormd.css" rel="stylesheet" type="text/css">
    <link th:href="@{/css/main.css}" href="../../static/css/main.css" rel="stylesheet" type="text/css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>Title</title>
    <script th:src="@{/js/jquery-3.4.0.js}" src="../../static/js/jquery-3.4.0.js" type="text/javascript"></script>
    <script th:src="@{/css/Semantic-UI-CSS-master/semantic.js}" src="../../static/css/Semantic-UI-CSS-master/semantic.js" type="text/javascript"></script>
    <script th:src="@{/lib/editormd/editormd.js}" src="../../static/lib/editormd/editormd.js" type="text/javascript"></script>
    <script th:src="@{/js/main.js}" src="../../static/js/main.js" type="text/javascript"></script>
</head>
<body>
<nav class="ui inverted attached segment" id="nav">
    <div class="ui container">
        <div class="ui inverted secondary menu">
            <h2 class="ui teal header item">Blog后台</h2>
            <a href="/admin/index" class="item active"><i class="home icon"></i> 博客</a>
            <a href="/admin/type" class="item"><i class="idea icon"></i> 分类</a>
            <a href="/admin/tag" class="item"><i class="tags icon"></i> 标签</a>
            <div class="right menu">
                <div class="ui dropdown item">
                    <div class="text"><img th:src="${#httpSession.getAttribute('admin').img}" src="../../static/img/brain.jpg" class="ui avatar image">
                        <span th:text="${#httpSession.getAttribute('admin').nickname}">梅迪乌斯</span>
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="/admin/logout" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>
<div class="ui menu attached pointing">
    <div class="ui center menu container m-margin-huge">
        <a class="item active" href="/admin/release">发布</a>
        <a class="item" href="/admin/index">列表</a>
    </div>
</div>
<div class="m-container-small m-padded-large">
    <div class="ui container">
        <form action="/admin/blogUpdateRelease" method="post" class="ui form">
            <input type="hidden" name="_method" value="put">
            <input type="hidden" name="blogId" th:value="${blog.id}">
            <div class="required field">
                <div class="ui left labeled input">
                    <div class="ui selected compact teal basic dropdown label">
                        <input type="hidden" name="flag" th:value="${blog.flag}">
                        <i class="dropdown icon"></i>
                        <div class="text" th:text="${blog.flag}">来源</div>
                        <div class="menu">
                            <div class="item" data-value="原创">原创</div>
                            <div class="item" data-value="转载">转载</div>
                        </div>
                    </div>
                    <input type="text" name="title" placeholder="标题" th:value="${blog.title}"/>
                </div>
            </div>
            <div class="field">
                <div id="md-content">
                    <textarea name="content" style="display: none" class="editormd-markdown-textarea" th:text="${blog.content}"></textarea>
                    <textarea placeholder="博客内容" name="viewContent" style="display: none"></textarea>
                </div>
            </div>
            <div class="two fields">
                <div class="field">
                    <div class="ui left labeled input">
                        <label class="ui compact teal basic label">分类</label>
                        <div class="ui fluid search selection dropdown">
                            <input type="hidden" name="typeId" th:value="${blog.type.getId()}">
                            <i class="dropdown icon"></i>
                            <div class="default text">分类</div>
                            <div class="menu">
                                <div th:each="type:${typeList}" class="item" th:data-value="${type.id}" th:text="${type.name}">错误日志</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div class="ui left labeled input">
                        <label class="ui compact teal basic label">标签</label>
                        <div class="ui fluid multiple search selection dropdown">
                            <input type="hidden" name="tagId" th:value="${tagId}">
                            <i class="dropdown icon"></i>
                            <div class="default text">标签</div>
                            <div class="menu">
                                <div th:each="tag:${tagList}" class="item" th:data-value="${tag.id}" th:text="${tag.name}">认知升级</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">图片</label>
                    <input type="text" name="picture" placeholder="图片地址" th:value="${blog.picture}"/>
                </div>
            </div>
            <div class="inline fields">
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="recommend" th:checked="${blog.recommend}" name="recommend" class="hidden">
                        <label for="recommend">推荐</label>
                    </div>
                </div>
            </div>
            <div class="ui error message"></div>
            <div class="ui right aligned container">
                <button class="ui teal button">发布</button>
            </div>
        </form>
    </div>
</div>
<script>
    var testEditor;
    testEditor = editormd("md-content", {
        width   : "100%",
        height  : 640,
        syncScrolling : "single",
        path    : "../lib/editormd/lib/"
    });
    $('.ui.dropdown').dropdown({
        on : 'hover'
    });
    $('.ui.form').form({
        fields : {
            title : {
                identifier : 'title',
                rules : [{
                    type : 'empty',
                    prompt : '标题，请输入标题内容'
                }]
            }
        }
    })
</script>
</body>
</html>